import Vue from 'vue'
import App from './App.vue'

//引入路由
import router from '@/router'

//三级联动组件---全局组件
import TypeNav from '@/pages/Home/TypeNav'
Vue.component(TypeNav.name, TypeNav)

//分页器---全局组件
import Pagination from '@/components/Pagination'
Vue.component(Pagination.name, Pagination)

//引入vuex仓库
import store from '@/store'

//引入MockServe.js ------ mock数据
import '@/mock/mockServe'

//引入swiper样式
import 'swiper/css/swiper.css'

//统一接收api文件中的全部请求
//统一引入
import * as API from '@/api'

//elementUI按需引入
import {Button, Message, MessageBox} from 'element-ui'

Vue.component(Button.name, Button)
Vue.prototype.$msgBox = MessageBox
Vue.prototype.$alert = MessageBox.alert
Vue.prototype.$message = Message

//引入vue懒加载
import VueLazyload from 'vue-lazyload'
import loadingGif from '@/assets/loading.gif'

Vue.use(VueLazyload, {
    loading: loadingGif //懒加载默认图片
})

Vue.config.productionTip = false

//引入表单验证插件
import '@/plugins/validate'

// 全局事件总线
new Vue({
    render: (h) => h(App),
    //全局事件总线
    beforeCreate() {
        Vue.prototype.$bus = this
        //全局引入API
        Vue.prototype.$API = API
    },
    router,
    store
}).$mount('#app')
